#ifndef H_PARTICLESYSTEM
#define H_PARTICLESYSTEM

#include "includes.h"
#include "actor.h"
#include "textfile.h"

class ParticleSystem: public Actor
{
public:
      struct Particle
        {
        Vector4f location;      //4th value is used for scale
        Vector3f normal;        //normal per particle - used for lighting
        Vector3f texCoord;      //texTure Coordinate per particle - can be used as color if we're point-skeletons or for projected texturing

        Vector4f color;
        Vector4f secondaryColor;    //used for vertex weighting and all sorts of other stuff!

        float birth;
        };

      std::vector<Particle> particles;
      std::vector<int> segments;

      ParticleSystem();

      virtual void setup();

      virtual void update(double deltaTime);
      virtual void updateShaders();

      virtual void drawParticles();
      virtual void drawAsLine();
      virtual void drawAsPath();
      virtual void drawCollision();

      void addParticles(int amount);
      void deleteParticle(int particleNumber);
      void addSegment();
      void addRandomParticles(int amount, float diameter);
      void createSquare(float xStretch, float zStretch);

      void create();
      virtual TiXmlElement* save(TiXmlElement *root);
      virtual void load(TiXmlElement *myInfo);
};
#endif
